package uk.ac.sanger.dasregistry.timer;
import java.util.Date;

import org.biojava.services.das.servlets.AutoValidator;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SimpleTrigger;
import org.quartz.Trigger;
import org.quartz.TriggerUtils;
import org.quartz.impl.StdSchedulerFactory;

public class QuartzTest {

    public static void main(String[] args) {

        try {
            // Grab the Scheduler instance from the Factory 
            Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();

            // and start it off
            scheduler.start();
            
         // Define job instance
            JobDetail job = new JobDetail("job1", "group1", LuceneIndexer.class);
            	
            // Define a Trigger that will fire "now"
            //Trigger trigger = new SimpleTrigger("trigger1", "group1", new Date());
            //Trigger trigger= TriggerUtils.makeHourlyTrigger("indexer", 10, 100000);
            Trigger trigger= TriggerUtils.makeMinutelyTrigger("indexer", 5, 100000);
            	
            // Schedule the job with the trigger
            scheduler.scheduleJob(job, trigger);

            
            

           // scheduler.shutdown();

        } catch (SchedulerException se) {
            se.printStackTrace();
        }
    }
}